/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.google.code.smon.types;

import com.google.code.smon.app.ServerType;
import com.google.code.smon.pers.Server;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author xero
 */
public class UndefinedServer extends ServerType {

    public UndefinedServer(Server server) {
        super(server);
    }

    @Override
    public boolean isOnline() {
        try {
            InetAddress srvAddr = InetAddress.getByName(getServer().getIp());
            if (srvAddr.isReachable(5000)) {

                return true;
            }
        } catch (IOException ex) {
            ex.printStackTrace();
            Logger.getLogger(UndefinedServer.class.getName()).log(Level.SEVERE, null, ex);
        }
        return false;

    }
}
